﻿using FluentNHibernate.Mapping;
using easyccms.BusinessLayer.Entities;

namespace easyccms.Nhibernate.Mappings
{
    /// <summary>
    /// Mapping of enitity User to table in database using nhibernate.
    /// </summary>
    public class SiteUserMap : ClassMap<SiteUser>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SiteUserMap"/> class.
        /// </summary>
        public SiteUserMap()
        {
            Table("Users");
            Id(x => x.UserId, "UserId");
            Map(x => x.Email);
            Map(x => x.EmailActivationCode);
            Map(x => x.Password);
            Map(x => x.PasswordSent);
            Map(x => x.PasswordCode);
            Map(x => x.LastLoginDate);
            Map(x => x.LockedOut);
            Map(x => x.Created);
            Map(x => x.Enabled);
            Map(x => x.Deleted);
            Map(x => x.CanBeDeleted);
            References(x => x.UserProfile).Cascade.None();
            References(x => x.UserGroup).Cascade.None();
            
        }
    }
}
